In the cache for rasterized vector layers, the legend is also saved in .xml. When the same vector data source is added back as a layer, this legend is assigned by default, allowing for the reuse of the cached images. If the legend changes (see above), the cache is rebuilt and the new .xml file is saved.